package com.wdb.modules.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wdb.modules.system.domain.User;
import com.wdb.modules.system.domain.vo.UserQueryCriteriaDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * @author: wendaobai@qq.com
 * @date: 2024/1/16 0016 16:18
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
  User findByUsername(@Param("username") String username);

  Page<User> getAll(
      @Param("criteria") UserQueryCriteriaDTO userQueryCriteria, @Param("page") Page page);

  /**
   * 根据 role ids 统计包含的用户数量
   *
   * @param roleIds
   * @return
   */
  int countByRoles(@Param("roleIds") List<Integer> roleIds);

  int countByJobs(@Param("jobIds") Set<Long> ids);
}
